//
//  GLUIKitPrebuiltLiveStreamingConfig.swift
//  GLUZSwift
//
//  Created by yu on 2025/3/29.
//

import Foundation


@objcMembers
class GLUIKitPrebuiltLiveStreamingConfig: ZegoUIKitPrebuiltLiveStreamingConfig {
    
    public var gl_bottomMenuBarConfig: GLLiveBottomMenuBarConfig = GLLiveBottomMenuBarConfig()
    
    override init() {
//        super.init()
        gl_bottomMenuBarConfig.hostButtons = [.toggleCameraButton, .toggleMicrophoneButton, .switchCameraButton]
        // 连麦中显示的功能
        gl_bottomMenuBarConfig.coHostButtons = [.toggleMicrophoneButton, .switchCameraButton, .coHostControlButton]
        gl_bottomMenuBarConfig.audienceButtons = [.coHostControlButton, .shoppingCarButton, .shopButton, .appointmentButton]
    }
    
    public static func gl_host(enableSignalingPlugin: Bool = false) -> GLUIKitPrebuiltLiveStreamingConfig {
        let config = GLUIKitPrebuiltLiveStreamingConfig()
        config.role = .host
        config.enableSignalingPlugin = enableSignalingPlugin
        config.turnOnCameraWhenJoining = true
        config.turnOnMicrophoneWhenJoining = true
        return config
    }
    
    public static func gl_audience(enableSignalingPlugin: Bool = false) -> GLUIKitPrebuiltLiveStreamingConfig {
        let config = GLUIKitPrebuiltLiveStreamingConfig()
        config.role = .audience
        config.enableSignalingPlugin = enableSignalingPlugin
        return config
    }
    
}

@objcMembers
public class GLLiveBottomMenuBarConfig: NSObject {
//    public var maxCount: UInt = 2
//    public var showInRoomMessageButton: Bool = true
    //MARK: The following properties are provided solely by Swift
    /// 主播
    public var hostButtons: [GLLiveStreamBottomBarButtonName] = []
    /// 连线主播
    public var coHostButtons: [GLLiveStreamBottomBarButtonName] = []
    /// 观众
    public var audienceButtons: [GLLiveStreamBottomBarButtonName] = []

    //MARK: The following properties are provided solely by OC
    @objc public var hostButtonsOC: NSArray {
        get {
            return hostButtons.map { NSNumber(value: $0.rawValue) } as NSArray
        }
        set {
          hostButtons = newValue.compactMap { GLLiveStreamBottomBarButtonName(rawValue: ($0 as AnyObject).intValue) }
        }
    }
    
    @objc public var coHostButtonsOC: NSArray {
        get {
            return coHostButtons.map { NSNumber(value: $0.rawValue) } as NSArray
        }
        set {
          coHostButtons = newValue.compactMap { GLLiveStreamBottomBarButtonName(rawValue: ($0 as AnyObject).intValue) }
        }
    }
    
    @objc public var audienceButtonsOC: NSArray {
        get {
            return audienceButtons.map { NSNumber(value: $0.rawValue) } as NSArray
        }
        set {
          audienceButtons = newValue.compactMap { GLLiveStreamBottomBarButtonName(rawValue: ($0 as AnyObject).intValue) }
        }
    }
    
}


